<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Lib.mudParser</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Lib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/x-venture">x-venture</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Lib-module.html">Package&nbsp;Lib</a> ::
        Module&nbsp;mudParser
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript: void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Lib.mudParser-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="Lib.mudParser-module.html">Module Lib.mudParser</a></h1>
<pre class="py-src">
<span class="py-lineno">  1</span>  <span class="py-line"><span class="py-comment">#@+leo-ver=4-thin</span> </span>
<span class="py-lineno">  2</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005194826:@thin .\\Lib\\mudParser.py</span> </span>
<span class="py-lineno">  3</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno">  4</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+middle:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno">  5</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005195515:&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno">  6</span>  <span class="py-line"><span class="py-comment"></span><span class="py-docstring">"""This is a simple parser for a mud grammar."""</span> </span>
<span class="py-lineno">  7</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">  8</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005195515:&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno">  9</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-middle:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno"> 10</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nl</span> </span>
<span class="py-lineno"> 11</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@@language python</span> </span>
<span class="py-lineno"> 12</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@@tabwidth -4</span> </span>
<span class="py-lineno"> 13</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno"> 14</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+middle:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno"> 15</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005195515.1:&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno"> 16</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+at </span> </span>
<span class="py-lineno"> 17</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 18</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment"># Place any imports here.</span> </span>
<span class="py-lineno"> 19</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-at</span> </span>
<span class="py-lineno"> 20</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@@c</span> </span>
<span class="py-lineno"> 21</span>  <span class="py-line"><span class="py-comment"></span><span class="py-keyword">from</span> <span class="py-name">copy</span> <span class="py-keyword">import</span> <span class="py-name">copy</span> </span>
<span class="py-lineno"> 22</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 23</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005195515.1:&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno"> 24</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-middle:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno"> 25</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nl</span> </span>
<span class="py-lineno"> 26</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+others</span> </span>
<span class="py-lineno"> 27</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno"> 28</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005231611:headers_footers</span> </span>
<span class="py-lineno"> 29</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005195839:class mudparse</span> </span>
<a name="mudparse"></a><div id="mudparse-def"><span class="py-lineno"> 30</span> <a class="py-toggle" href="#" id="mudparse-toggle" onclick="toggle('mudparse'); return false;">-</a><span class="py-line"><span class="py-comment"></span><span class="py-keyword">class</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html">mudparse</a><span class="py-op">:</span> </span>
</div><div id="mudparse-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="mudparse-expanded"><span class="py-lineno"> 31</span>  <span class="py-line">    <span class="py-docstring">"""Create instance then pass in string which returns a dictionary."""</span> </span>
<span class="py-lineno"> 32</span>  <span class="py-line">     </span>
<span class="py-lineno"> 33</span>  <span class="py-line"> </span>
<span class="py-lineno"> 34</span>  <span class="py-line">         </span>
<span class="py-lineno"> 35</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 36</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061024181122:__init__</span> </span>
<a name="mudparse.__init__"></a><div id="mudparse.__init__-def"><span class="py-lineno"> 37</span> <a class="py-toggle" href="#" id="mudparse.__init__-toggle" onclick="toggle('mudparse.__init__'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#__init__">__init__</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.__init__-expanded"><span class="py-lineno"> 38</span>  <span class="py-line">        <span class="py-docstring">"""Create dictionary."""</span> </span>
<span class="py-lineno"> 39</span>  <span class="py-line">         </span>
<span class="py-lineno"> 40</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">sentstruct</span> <span class="py-op">=</span> <span class="py-op">{</span><span class="py-string">"verb"</span><span class="py-op">:</span> <span class="py-name">None</span><span class="py-op">,</span> <span class="py-string">"directprep"</span><span class="py-op">:</span> <span class="py-name">None</span><span class="py-op">,</span> <span class="py-string">"directnoun"</span><span class="py-op">:</span>  </span>
<span class="py-lineno"> 41</span>  <span class="py-line">        <span class="py-name">None</span><span class="py-op">,</span> <span class="py-string">"indirectprep"</span><span class="py-op">:</span> <span class="py-name">None</span><span class="py-op">,</span> <span class="py-string">"indirectnoun"</span><span class="py-op">:</span> <span class="py-name">None</span><span class="py-op">,</span><span class="py-string">"args"</span><span class="py-op">:</span><span class="py-name">None</span><span class="py-op">}</span> </span>
<span class="py-lineno"> 42</span>  <span class="py-line">         </span>
<span class="py-lineno"> 43</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">preposition</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-string">"IN"</span><span class="py-op">,</span><span class="py-string">"ON"</span><span class="py-op">,</span><span class="py-string">"AT"</span><span class="py-op">]</span> </span>
</div><span class="py-lineno"> 44</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 45</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061024181122:__init__</span> </span>
<span class="py-lineno"> 46</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061012153541:preparse</span> </span>
<a name="mudparse.preparse"></a><div id="mudparse.preparse-def"><span class="py-lineno"> 47</span> <a class="py-toggle" href="#" id="mudparse.preparse-toggle" onclick="toggle('mudparse.preparse'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#preparse">preparse</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.preparse-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.preparse-expanded"><span class="py-lineno"> 48</span>  <span class="py-line">        <span class="py-docstring">"""Parses commands to see if meet any special requirements before</span> </span>
<span class="py-lineno"> 49</span>  <span class="py-line"><span class="py-docstring">        passing to parsemain."""</span> </span>
<span class="py-lineno"> 50</span>  <span class="py-line">         </span>
<span class="py-lineno"> 51</span>  <span class="py-line">        <span class="py-name">muddict</span> <span class="py-op">=</span> <span class="py-name">copy</span><span class="py-op">(</span><span class="py-name">self</span><span class="py-op">.</span><span class="py-name">sentstruct</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 52</span>  <span class="py-line">        <span class="py-name">cmd</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-0" class="py-name"><a title="Lib.mudParser.mudparse.stripcap" class="py-name" href="#" onclick="doclink('link-0', 'stripcap', 'Method Lib.mudParser.mudparse.stripcap()=Lib.mudParser.mudparse-class.html#stripcap'); return false;">stripcap</a></span></span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 53</span>  <span class="py-line">        <span class="py-name">verb</span><span class="py-op">,</span> <span class="py-name">args</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-1" class="py-name"><a title="Lib.mudParser.mudparse.getverb" class="py-name" href="#" onclick="doclink('link-1', 'getverb', 'Method Lib.mudParser.mudparse.getverb()=Lib.mudParser.mudparse-class.html#getverb'); return false;">getverb</a></span></span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 54</span>  <span class="py-line">        <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"verb"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">verb</span> </span>
<span class="py-lineno"> 55</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"verb"</span><span class="py-op">]</span> <span class="py-op">==</span> <span class="py-string">"SAY"</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 56</span>  <span class="py-line">            <span class="py-name">sentence</span> <span class="py-op">=</span> <span class="py-string">" "</span><span class="py-op">.</span><span class="py-name">join</span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 57</span>  <span class="py-line">            <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"args"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">sentence</span> </span>
<span class="py-lineno"> 58</span>  <span class="py-line">        <span class="py-name">temp</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno"> 59</span>  <span class="py-line">        <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 60</span>  <span class="py-line">        <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">muddict</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 61</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">temp</span> </span>
</div><span class="py-lineno"> 62</span>  <span class="py-line">         </span>
<span class="py-lineno"> 63</span>  <span class="py-line">         </span>
<span class="py-lineno"> 64</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 65</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061012153541:preparse</span> </span>
<span class="py-lineno"> 66</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005200343:stripcap</span> </span>
<a name="mudparse.stripcap"></a><div id="mudparse.stripcap-def"><span class="py-lineno"> 67</span> <a class="py-toggle" href="#" id="mudparse.stripcap-toggle" onclick="toggle('mudparse.stripcap'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#stripcap">stripcap</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.stripcap-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.stripcap-expanded"><span class="py-lineno"> 68</span>  <span class="py-line">        <span class="py-docstring">"""Takes a string, removes instances of a, an and the, then </span> </span>
<span class="py-lineno"> 69</span>  <span class="py-line"><span class="py-docstring">        capitalizes and returns list of all elements."""</span> </span>
<span class="py-lineno"> 70</span>  <span class="py-line">         </span>
<span class="py-lineno"> 71</span>  <span class="py-line">        <span class="py-name">WHITE</span> <span class="py-op">=</span> <span class="py-string">" "</span> </span>
<span class="py-lineno"> 72</span>  <span class="py-line">        <span class="py-name">BLANK</span> <span class="py-op">=</span> <span class="py-string">""</span> </span>
<span class="py-lineno"> 73</span>  <span class="py-line">        <span class="py-name">articles</span> <span class="py-op">=</span> <span class="py-op">(</span><span class="py-string">"A"</span><span class="py-op">,</span><span class="py-string">"AN"</span><span class="py-op">,</span><span class="py-string">"THE"</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 74</span>  <span class="py-line">        <span class="py-name">cmd</span> <span class="py-op">=</span> <span class="py-name">cmd</span><span class="py-op">.</span><span class="py-name">upper</span><span class="py-op">(</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 75</span>  <span class="py-line">        <span class="py-keyword">for</span> <span class="py-name">article</span> <span class="py-keyword">in</span> <span class="py-name">articles</span><span class="py-op">:</span> </span>
<span class="py-lineno"> 76</span>  <span class="py-line">            <span class="py-name">cmd</span> <span class="py-op">=</span> <span class="py-name">cmd</span><span class="py-op">.</span><span class="py-name">replace</span><span class="py-op">(</span><span class="py-name">article</span> <span class="py-op">+</span> <span class="py-name">WHITE</span><span class="py-op">,</span> <span class="py-name">BLANK</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 77</span>  <span class="py-line">        <span class="py-name">cmd</span> <span class="py-op">=</span> <span class="py-name">cmd</span><span class="py-op">.</span><span class="py-name">split</span><span class="py-op">(</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 78</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">cmd</span> </span>
</div><span class="py-lineno"> 79</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 80</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005200343:stripcap</span> </span>
<span class="py-lineno"> 81</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005200926:getverb</span> </span>
<a name="mudparse.getverb"></a><div id="mudparse.getverb-def"><span class="py-lineno"> 82</span> <a class="py-toggle" href="#" id="mudparse.getverb-toggle" onclick="toggle('mudparse.getverb'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#getverb">getverb</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.getverb-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.getverb-expanded"><span class="py-lineno"> 83</span>  <span class="py-line">        <span class="py-docstring">"""sets verb in dictionary to first first word in sentence. Removes</span> </span>
<span class="py-lineno"> 84</span>  <span class="py-line"><span class="py-docstring">        first word in sentence."""</span> </span>
<span class="py-lineno"> 85</span>  <span class="py-line">         </span>
<span class="py-lineno"> 86</span>  <span class="py-line">        <span class="py-name">temp</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno"> 87</span>  <span class="py-line">        <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 88</span>  <span class="py-line">        <span class="py-name">cmd</span><span class="py-op">.</span><span class="py-name">remove</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 89</span>  <span class="py-line">        <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno"> 90</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">temp</span> </span>
</div><span class="py-lineno"> 91</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 92</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005200926:getverb</span> </span>
<span class="py-lineno"> 93</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005203939:getprep</span> </span>
<a name="mudparse.getprep"></a><div id="mudparse.getprep-def"><span class="py-lineno"> 94</span> <a class="py-toggle" href="#" id="mudparse.getprep-toggle" onclick="toggle('mudparse.getprep'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#getprep">getprep</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.getprep-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.getprep-expanded"><span class="py-lineno"> 95</span>  <span class="py-line">        <span class="py-docstring">"""Will return none if token is not a preposition, else will return </span> </span>
<span class="py-lineno"> 96</span>  <span class="py-line"><span class="py-docstring">        preposition."""</span> </span>
<span class="py-lineno"> 97</span>  <span class="py-line">         </span>
<span class="py-lineno"> 98</span>  <span class="py-line">        <span class="py-name">temp</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno"> 99</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">len</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> <span class="py-op">==</span> <span class="py-number">0</span><span class="py-op">:</span> </span>
<span class="py-lineno">100</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">)</span> </span>
<span class="py-lineno">101</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno">102</span>  <span class="py-line">            <span class="py-keyword">return</span> <span class="py-name">temp</span> </span>
<span class="py-lineno">103</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">cmd</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span> <span class="py-keyword">in</span> <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">preposition</span><span class="py-op">:</span> </span>
<span class="py-lineno">104</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span><span class="py-op">)</span> </span>
<span class="py-lineno">105</span>  <span class="py-line">            <span class="py-name">cmd</span><span class="py-op">.</span><span class="py-name">remove</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span><span class="py-op">)</span> </span>
<span class="py-lineno">106</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno">107</span>  <span class="py-line">        <span class="py-keyword">else</span><span class="py-op">:</span> </span>
<span class="py-lineno">108</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">)</span> </span>
<span class="py-lineno">109</span>  <span class="py-line">            <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno">110</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">temp</span> </span>
</div><span class="py-lineno">111</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">112</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005203939:getprep</span> </span>
<span class="py-lineno">113</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005203939.1:getnoun</span> </span>
<a name="mudparse.getnoun"></a><div id="mudparse.getnoun-def"><span class="py-lineno">114</span> <a class="py-toggle" href="#" id="mudparse.getnoun-toggle" onclick="toggle('mudparse.getnoun'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#getnoun">getnoun</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.getnoun-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.getnoun-expanded"><span class="py-lineno">115</span>  <span class="py-line">        <span class="py-docstring">"""Will return list of all words till either list ends or element </span> </span>
<span class="py-lineno">116</span>  <span class="py-line"><span class="py-docstring">        is a preposition."""</span> </span>
<span class="py-lineno">117</span>  <span class="py-line">         </span>
<span class="py-lineno">118</span>  <span class="py-line">        <span class="py-name">temp</span> <span class="py-op">=</span><span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno">119</span>  <span class="py-line">        <span class="py-name">noun</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno">120</span>  <span class="py-line">        <span class="py-name">other</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno">121</span>  <span class="py-line">        <span class="py-name">prepflag</span> <span class="py-op">=</span> <span class="py-number">0</span> </span>
<span class="py-lineno">122</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">len</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> <span class="py-op">==</span> <span class="py-number">0</span><span class="py-op">:</span> </span>
<span class="py-lineno">123</span>  <span class="py-line">            <span class="py-name">noun</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">None</span><span class="py-op">)</span> </span>
<span class="py-lineno">124</span>  <span class="py-line">            <span class="py-name">noun</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno">125</span>  <span class="py-line">            <span class="py-keyword">return</span> <span class="py-name">noun</span> </span>
<span class="py-lineno">126</span>  <span class="py-line">        <span class="py-keyword">for</span> <span class="py-name">word</span> <span class="py-keyword">in</span> <span class="py-name">cmd</span><span class="py-op">:</span> </span>
<span class="py-lineno">127</span>  <span class="py-line">            <span class="py-keyword">if</span> <span class="py-name">prepflag</span> <span class="py-op">==</span> <span class="py-number">1</span><span class="py-op">:</span> </span>
<span class="py-lineno">128</span>  <span class="py-line">                <span class="py-name">other</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">word</span><span class="py-op">)</span> </span>
<span class="py-lineno">129</span>  <span class="py-line">            <span class="py-keyword">elif</span> <span class="py-name">word</span> <span class="py-keyword">not</span> <span class="py-keyword">in</span> <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">preposition</span><span class="py-op">:</span> </span>
<span class="py-lineno">130</span>  <span class="py-line">                <span class="py-name">temp</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">word</span><span class="py-op">)</span> </span>
<span class="py-lineno">131</span>  <span class="py-line">            <span class="py-keyword">else</span><span class="py-op">:</span> </span>
<span class="py-lineno">132</span>  <span class="py-line">                <span class="py-name">other</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">word</span><span class="py-op">)</span> </span>
<span class="py-lineno">133</span>  <span class="py-line">                <span class="py-name">prepflag</span> <span class="py-op">=</span> <span class="py-number">1</span> </span>
<span class="py-lineno">134</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">len</span><span class="py-op">(</span><span class="py-name">other</span><span class="py-op">)</span> <span class="py-op">==</span> <span class="py-number">0</span><span class="py-op">:</span> </span>
<span class="py-lineno">135</span>  <span class="py-line">            <span class="py-name">other</span> <span class="py-op">=</span> <span class="py-name">None</span> </span>
<span class="py-lineno">136</span>  <span class="py-line">        <span class="py-name">noun</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">temp</span><span class="py-op">)</span> </span>
<span class="py-lineno">137</span>  <span class="py-line">        <span class="py-name">noun</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">other</span><span class="py-op">)</span> </span>
<span class="py-lineno">138</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">noun</span> </span>
</div><span class="py-lineno">139</span>  <span class="py-line">         </span>
<span class="py-lineno">140</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">141</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005203939.1:getnoun</span> </span>
<span class="py-lineno">142</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061005203939.2:parsemain</span> </span>
<a name="mudparse.parsemain"></a><div id="mudparse.parsemain-def"><span class="py-lineno">143</span> <a class="py-toggle" href="#" id="mudparse.parsemain-toggle" onclick="toggle('mudparse.parsemain'); return false;">-</a><span class="py-line"><span class="py-comment"></span>    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.mudParser.mudparse-class.html#parsemain">parsemain</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">cmd</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="mudparse.parsemain-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mudparse.parsemain-expanded"><span class="py-lineno">144</span>  <span class="py-line">        <span class="py-docstring">"""Calls functions in order and assigns elements to dict based on </span> </span>
<span class="py-lineno">145</span>  <span class="py-line"><span class="py-docstring">        return."""</span> </span>
<span class="py-lineno">146</span>  <span class="py-line">         </span>
<span class="py-lineno">147</span>  <span class="py-line">        <span class="py-name">temp</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-2" class="py-name"><a title="Lib.mudParser.mudparse.preparse" class="py-name" href="#" onclick="doclink('link-2', 'preparse', 'Method Lib.mudParser.mudparse.preparse()=Lib.mudParser.mudparse-class.html#preparse'); return false;">preparse</a></span></span><span class="py-op">(</span><span class="py-name">cmd</span><span class="py-op">)</span> </span>
<span class="py-lineno">148</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">temp</span><span class="py-op">[</span><span class="py-number">0</span><span class="py-op">]</span> <span class="py-op">==</span> <span class="py-name">None</span><span class="py-op">:</span> </span>
<span class="py-lineno">149</span>  <span class="py-line">            <span class="py-keyword">return</span> <span class="py-name">temp</span><span class="py-op">[</span><span class="py-number">1</span><span class="py-op">]</span> </span>
<span class="py-lineno">150</span>  <span class="py-line">        <span class="py-name">args</span><span class="py-op">,</span><span class="py-name">muddict</span> <span class="py-op">=</span> <span class="py-name">temp</span> </span>
<span class="py-lineno">151</span>  <span class="py-line">        <span class="py-name">prep</span><span class="py-op">,</span> <span class="py-name">args</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-3" class="py-name"><a title="Lib.mudParser.mudparse.getprep" class="py-name" href="#" onclick="doclink('link-3', 'getprep', 'Method Lib.mudParser.mudparse.getprep()=Lib.mudParser.mudparse-class.html#getprep'); return false;">getprep</a></span></span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno">152</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">prep</span> <span class="py-keyword">is</span> <span class="py-keyword">not</span> <span class="py-name">None</span><span class="py-op">:</span> </span>
<span class="py-lineno">153</span>  <span class="py-line">            <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"directprep"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">prep</span> </span>
<span class="py-lineno">154</span>  <span class="py-line">        <span class="py-name">noun</span><span class="py-op">,</span> <span class="py-name">args</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-4" class="py-name"><a title="Lib.mudParser.mudparse.getnoun" class="py-name" href="#" onclick="doclink('link-4', 'getnoun', 'Method Lib.mudParser.mudparse.getnoun()=Lib.mudParser.mudparse-class.html#getnoun'); return false;">getnoun</a></span></span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno">155</span>  <span class="py-line">        <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"directnoun"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">noun</span> </span>
<span class="py-lineno">156</span>  <span class="py-line">        <span class="py-keyword">if</span> <span class="py-name">args</span> <span class="py-keyword">is</span> <span class="py-keyword">not</span> <span class="py-name">None</span><span class="py-op">:</span> </span>
<span class="py-lineno">157</span>  <span class="py-line">            <span class="py-name">inprep</span><span class="py-op">,</span> <span class="py-name">args</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-5" class="py-name"><a title="Lib.mudParser.mudparse.getprep" class="py-name" href="#" onclick="doclink('link-5', 'getprep', 'Method Lib.mudParser.mudparse.getprep()=Lib.mudParser.mudparse-class.html#getprep'); return false;">getprep</a></span></span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno">158</span>  <span class="py-line">            <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"indirectprep"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">inprep</span> </span>
<span class="py-lineno">159</span>  <span class="py-line">            <span class="py-name">innoun</span><span class="py-op">,</span> <span class="py-name">args</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span id="link-6" class="py-name"><a title="Lib.mudParser.mudparse.getnoun" class="py-name" href="#" onclick="doclink('link-6', 'getnoun', 'Method Lib.mudParser.mudparse.getnoun()=Lib.mudParser.mudparse-class.html#getnoun'); return false;">getnoun</a></span></span><span class="py-op">(</span><span class="py-name">args</span><span class="py-op">)</span> </span>
<span class="py-lineno">160</span>  <span class="py-line">            <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"indirectnoun"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">innoun</span> </span>
<span class="py-lineno">161</span>  <span class="py-line">            <span class="py-name">muddict</span><span class="py-op">[</span><span class="py-string">"args"</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">None</span> </span>
<span class="py-lineno">162</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">muddict</span> </span>
</div></div><span class="py-lineno">163</span>  <span class="py-line">             </span>
<span class="py-lineno">164</span>  <span class="py-line">         </span>
<span class="py-lineno">165</span>  <span class="py-line">         </span>
<span class="py-lineno">166</span>  <span class="py-line">         </span>
<span class="py-lineno">167</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">168</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005203939.2:parsemain</span> </span>
<span class="py-lineno">169</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005195839:class mudparse</span> </span>
<span class="py-lineno">170</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-others</span> </span>
<span class="py-lineno">171</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">172</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061005194826:@thin .\\Lib\\mudParser.py</span> </span>
<span class="py-lineno">173</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-leo</span> </span>
<span class="py-lineno">174</span>  <span class="py-line"><span class="py-comment"></span> </span><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Lib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/x-venture">x-venture</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Tue Oct 24 18:24:47 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
